﻿using System;
using System.Web.UI;

namespace UDS.SubModule.UnitiveDocument.Setup
{
    /// <summary>
    /// MySetup 的摘要说明。
    /// </summary>
    public partial class MySetupPage : Page
    {
        protected override void OnInit(EventArgs e)
        {
            cmdOK.Click += cmdOK_Click;
            base.OnInit(e);
        }

        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (txtNewPassword.Text == txtReNewPassword.Text)
            {
                if (Components.Staff.ModifyPassword(SiteContext.Current.UserName, txtOldPassword.Text, txtNewPassword.Text))
                {
                    Response.Write("<script language=javascript>alert('密码修改成功!');</script>");
                }
                else
                {
                    Response.Write("<script language=javascript>alert('原密码不对!');</script>");
                }
            }
            else
            {
                Response.Write("<script language=javascript>alert('重复密码不一致!');</script>");
            }
        }
    }
}